<?php

$xml = simplexml_load_file("listing20-4.xml");		// load 

foreach ($xml->book as $book) {
	printf("%s is %s. \n", $book->author, $book->author->attributes());		// parse element and its attribute
}

echo $xml->book[2]->author->attributes();		// parse by direct path.